package com.abc.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @Value注解只能在spring管理的bean中使用，不在spring管理的bean怎么读取yml配置内容,参考 https://blog.csdn.net/xiao______xin/article/details/73274830
 *
 * 先创建一个对象 用于映射该配置文件的值 如下:
 * 该对象中一定要有@Component
 */
@Component
@ConfigurationProperties(prefix = "cipher")
public class CipherProperties {

    private String privateKey1;
    private String publicKey2;

    public String getPrivateKey1() {
        return privateKey1;
    }

    public void setPrivateKey1(String privateKey1) {
        this.privateKey1 = privateKey1;
    }

    public String getPublicKey2() {
        return publicKey2;
    }

    public void setPublicKey2(String publicKey2) {
        this.publicKey2 = publicKey2;
    }

    @Override
    public String toString() {
        return "CipherProperties{" +
                "privateKey1='" + privateKey1 + '\'' +
                ", publicKey2='" + publicKey2 + '\'' +
                '}';
    }
}
